<?php
namespace Common\Model;
use Think\Model;
class FundingOrderModel extends Model {

    /**
     * model的中文名称
     */
    public $modelName = '筹单参与';

    /**
     * model的icon
     */
    public $modelIcon = 'icon-group';
    
    protected $_auto = [
        ["create_time", "strtotime", 3, "function"],
        ["update_time", "strtotime", 3, "function"],
        ["create_time", "time", 1, "function"],
        ["update_time", "time", 2, "function"],
    ];
    protected $_validate = [
        ["id", "require", "ID必须填写!"],
        ["user_id", "require", "购买用户必须填写!"],
        ["name", "require", "预留姓名必须填写!"],
        ["phone", "require", "预留电话必须填写!"],
        ["funding_id", "require", "筹单必须填写!"],
        ["help_id", "require", "代卖用户必须填写!"],
        ["state", "require", "状态必须填写!"],
        ["create_time", "require", "创建时间必须填写!"],
        ["update_time", "require", "更新时间必须填写!"],
    ];
    public $excel = false;
    public $fieldMap = [
        "id"=>[
            "type"=>"input",
            "name"=>"ID",
            "list"=>true,
            "search"=>true,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "user_id"=>[
            "type"=>"foreign",
            "name"=>"购买用户",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"user,id,name,input",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "name"=>[
            "type"=>"input",
            "name"=>"预留姓名",
            "list"=>true,
            "search"=>true,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "phone"=>[
            "type"=>"input",
            "name"=>"预留电话",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "funding_id"=>[
            "type"=>"foreign",
            "name"=>"筹单",
            "list"=>true,
            "search"=>true,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"funding,id,name,input",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "tourist_ids"=>[
            "type"=>"input",
            "name"=>"游客",
            "list"=>true,
            "search"=>true,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>'
<td class="center">
    <php>
        $tourist_ids_arr = explode(",", $vo["tourist_ids"]);
        $tourists = "";
        foreach ($tourist_ids_arr as $tourist_id) {
            $tourists .= ",".D("Tourist")->find($tourist_id)["name"];
        }
    </php>
    {:trim($tourists, ",")}
</td>',
            "update_specify"=>"",
            "detail_specify"=>'
                    <tr>
                    <td class="center" width="20%">游客</td>
                    <td class="center">
                        <php>
                            $tourist_ids_arr = explode(",", $detail["tourist_ids"]);
                            $tourists = "";
                            foreach ($tourist_ids_arr as $tourist_id) {
                                $tourists .= ",".D("Tourist")->find($tourist_id)["name"];
                            }
                        </php>
                        {:trim($tourists, ",")}
                    </td>
                </tr>
            ',
        ],

        "help_id"=>[
            "type"=>"foreign",
            "name"=>"代卖用户",
            "list"=>false,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"user,id,name,input",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "state"=>[
            "type"=>"input",
            "name"=>"状态",
            "list"=>true,
            "search"=>false,
            "input"=>true,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "create_time"=>[
            "type"=>"datetime",
            "name"=>"创建时间",
            "list"=>false,
            "search"=>false,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
        "update_time"=>[
            "type"=>"datetime",
            "name"=>"更新时间",
            "list"=>false,
            "search"=>false,
            "input"=>false,
            "required"=>true,
            "detail"=>true,
            "excel"=>true,
            "content"=>"",
            "list_specify"=>"",
            "update_specify"=>"",
            "detail_specify"=>"",
        ],
    ];
}